import logging

from autoscrapy import config
# set log
log_file = config.log_file or '/var/log/autoscrapy.log'
log_level = config.log_level or logging.INFO
log_format = '%(asctime)s:%(name)s:%(levelname)s:%(message)s'
logging.basicConfig(filename=log_file, level=log_level, format=log_format)

_loggers = {}
def get_logging(name):
    if name not in _loggers:
        _loggers[name] = logging.getLogger(name)
    return _loggers[name]

